package com.jackeys.piaems.dao.mapper;

import com.jackeys.piaems.annotation.PassJwt;
import com.jackeys.piaems.dto.PaymentDetailDto;
import com.jackeys.piaems.entity.Payment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import javax.xml.crypto.Data;
import java.net.Inet4Address;
import java.util.Date;
import java.util.List;

/**
 * @InterfaceName: PaymentMapper
 * @Description: 账单映射接口
 * @Author: Jackeys
 * @Date: 2021-06-16 21:23
 * @Version: 1.0
 */
@Mapper
public interface PaymentMapper {
    //添加账单
    Boolean insertPayment(@Param("userId") Long userId, @Param("categoryId") Long categoryId, @Param("date") Date date, @Param("cost") Float cost, @Param("remark") String remark, @Param("flag") Integer flag);

    //删除账单
    Boolean deletePayment(@Param("id") Long id);

    //修改订单
    Boolean updatePayment(@Param("id") Long id, @Param("categoryId") Long categoryId, @Param("cost") Float cost, @Param("remark") String remark, @Param("flag") Integer flag);

    //根据日期查询某一日期下的所有账单记录
    List<PaymentDetailDto> selectPaymentsByDate(@Param("userId") Long userId, @Param("date") Date date, @Param("flag") Integer flag);

    //查询用户收入与支出总和
    Float selectInAndOutSum(@Param("userId") Long userId, @Param("flag") Integer flag);

    //查询大概的账单
    List<Payment> selectTotalPaymentList(@Param("userId") Long userId, @Param("start") Integer start, @Param("size") Integer size, @Param("flag") Integer flag);

    //查询总览的数量
    Integer selectCntByTotal(@Param("userId") Long userId, @Param("flag") Integer flag);

    //返回给前端图
    List<Payment> selectAllPayment(@Param("userId") Long userId,@Param("flag")Integer flag);
}
